package test8;

public class PhoneTest {
    public static void main(String[] args) {
        Phone[] arry = new Phone[3];

        Phone p1 = new Phone("小米",4999,"白色");
        Phone p2 = new Phone("华为",6999,"蓝色");
        Phone p3 = new Phone("魅族",2999,"黑色");

        arry[0] = p1;
        arry[1] = p2;
        arry[2] = p3;

        int sum = 0;

        for (int i = 0; i < arry.length; i++) {
            Phone phone = arry[i];
            sum += phone.getPrice();
        }

        int avg = sum / arry.length;

        System.out.println(avg);
    }
}
